Ccay.Module.define("Ccay.example.ui.pager",function(page,$S){
	/**
	 * 导入枚举类型
	 */
	//debugger;
	Enum.import("SexEnum");
	
	page.ready=function(){
		//整个页面的初始化
		$S("#pager").ccayTab();
		$S('#pagerDemo').pager({
			mode:null,
			pageInf:{totalRows:2000},
			fnPageChanged:function(pageInf){
		}});
		$('#pagerNumber').pager({
			pageInf:{totalRows:55,pageSize:10},
			mode:'number'
		});
		
		$('#pagerNumber2').pager({
			pageInf:{totalRows:55,pageSize:10},
			//如果设定的每页结果数为一个选项时，则不提供下拉框选择
		    pageSizes:[10],
			mode:'number'
		});
		
		$('#listPager').pager({
			isInitChange:true,
			fnPageChanged:function(pageInf){
				bindList(pageInf);
			}
	    });
	
	
	 	function bindList(pageInf){
			$('#tbTmpl').ccayTemplate({
				tmpl:"<tr><td align='center'>${index}</td><td>${name}</td><td>${sex}</td><td align='center'>${age}</td></tr>",
				startIndex:(pageInf.curPage -1) * pageInf.pageSize + 1,
				ajax:{
						url:"services/ccay/demo/student/list/page/{0}/{1}".format(pageInf.pageSize,pageInf.curPage)
						,success:function(data){
							$('#listPager').pager({pageInf:data.pageVO});
						}
					}
				});
		}
		};
	
});